﻿using System.Windows;
using System;
using System.Data;
using System.Windows.Controls;

namespace PSSMS.View.SysManage
{
    /// <summary>
    /// DY_ghsPr.xaml 的交互逻辑
    /// </summary>
    public partial class DY_ghsPr : Window
    {
        DataTable DT;
        public DY_ghsPr(DataTable dt)
        {
            InitializeComponent();
            DT = dt;//接收表格
        }

        /// <summary>
        /// 加载事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            //绑定表格数据源
            dgvStaff.ItemsSource = DT.DefaultView;
            lbl_Tiem.Content = "打印时间：" + DateTime.Now.ToString("yyyy年MM月dd日 HH时mm分ss秒");
        }
        /// <summary>
        /// 打印表格数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void mi_print_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                PrintDialog print = new PrintDialog();
                if(print.ShowDialog()== true)
                {
                    print.PrintVisual(printDockPanel, "打印表格");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "系统提示", MessageBoxButton.OKCancel, MessageBoxImage.Error);
            }
        }
    }
}
